using System;
using System.Collections.Generic;
using System.Text;
using Utility;
using DAL;
using DTO;
namespace BUS
{
    public class tbSeriBUS
    {
        public void Insert(tbSeri seRi)
        {
            tbSeriDAL srDAL = new tbSeriDAL();
            srDAL.Insert(seRi);
        }

        public void Update(tbSeri seRi)
        {
            tbSeriDAL srDAL = new tbSeriDAL();
            srDAL.Update(seRi);
        }

        public void Delete(int iD)
        {
            tbSeriDAL srDAL = new tbSeriDAL();
            srDAL.Delete(iD);
        }

        public static tbSeriCollection Get(string where, int pageindex, int pagesize, string orderby, string orderdirection, out int total)
        {
            tbSeriDAL srDAL = new tbSeriDAL();
            return srDAL.Get(where, pageindex, pagesize, orderby, orderdirection, out total);
        }
        public static tbSeriCollection GetAll()
        {
            int total = 0;
            Criteria cri = new Criteria();
            tbSeriDAL srDAL = new tbSeriDAL();
            return srDAL.Get(cri.Criter, 0, 0, tbSeriColumns.sott.ToString(), OrderDirection.ASC.ToString(), out total);
        }
        public static tbSeri GetByID(int iD)
        {
            int total = 0;
            Criteria cri = new Criteria();
            cri.add(Condition.AND, tbSeriColumns.sott.ToString(), Condition.EQUAL, iD);
            tbSeriDAL srDAL = new tbSeriDAL();
            tbSeriCollection srCollection = srDAL.Get(cri.Criter, 0, 0, tbSeriColumns.sott.ToString(), OrderDirection.ASC.ToString(), out total);
            if (srCollection.Count > 0)
                return srCollection[0];
            return null;
        }
    }
}
